package mop.exception;

import java.sql.Date;

/**
 * Exception class to be thrown when business rule 1 is violated
 * 
 * @author	 MOP Team 7
 */

public class IllegalDateException extends Throwable{


	/**
	 * Initializes an IllegalDateException with the problematic date
	 * 
	 * @param date	The problematic date
	 *  
	 * @post Set the date
	 * 	this.date == date
	 */
	public IllegalDateException(Date date)
	{
		this.date = date;
	}
	
	/**
	 * Return a error message that can be used by the GUI
	 * @return An error message describing the incorrect date
	 */
	public String toString()
	{
		
		StringBuffer sb = new StringBuffer();
		sb.append("Given date is invalid ! : ");
		sb.append(this.date);
		return sb.toString();
		
	}
	
	/**
	 * Weird java demand
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * The problematic date
	 */
	private final Date date;
		
	

}
